package com.sitech.portal.system.dao.ibatis;

import java.util.List;

import com.sitech.ibnms.core.BaseIbnmsDao;
import com.sitech.portal.system.dao.ISysCompanyDao;
import com.sitech.portal.system.domain.TblSYS_COMPANY;

public class SysCompanyDaoImpl extends BaseIbnmsDao implements ISysCompanyDao {

	public void add(TblSYS_COMPANY tblSYS_COMPANY) {
		if (tblSYS_COMPANY.getCOMP_ID() == null) {
			this.insert("insertTblSYS_COMPANY", tblSYS_COMPANY);
		} else {
			this.insert("insertTblSYS_COMPANY", tblSYS_COMPANY);
		}
	}

	public synchronized String generateKey() {
		String n = (String) this.querySingle(
				"findIdMaxValueForTblSYS_COMPANY", null);

		return n;
	}

	public void update(TblSYS_COMPANY tblSYS_COMPANY) {
		this.update("updateTblSYS_COMPANY", tblSYS_COMPANY);
	}

	public void delete(TblSYS_COMPANY tblSYS_COMPANY) {
		this.delete("deleteTblSYS_COMPANY", tblSYS_COMPANY);
	}

	public TblSYS_COMPANY findCompanyObjByPk(TblSYS_COMPANY obj) {
		if (obj == null) {
			return null;
		} else {
			return (TblSYS_COMPANY) this.querySingle(
					"findByIdForTblSYS_COMPANY", obj.getCOMP_ID());
		}
	}

	public List findByList(TblSYS_COMPANY obj) {
		if (obj == null) {
			return this.query("findByListForTblSYS_COMPANY",
					null);
		} else {
			return this.query("findByListForTblSYS_COMPANY",
					obj);
		}
	}

	public List findCompanyHaveChildByList(TblSYS_COMPANY obj) {
		return this.query("findCompanyHaveChildByList", obj);
	}
}
